<html>
<body>
<div id="container">
	<?php
		$field = new Zend_Session_Namespace('field');
		$results=$field->results;
		//echo $this->message . '<br><br>';
		$count=count($results);
		if($count==1){
			echo("Your search returned 1 result<br/>");
		}
		else{
			echo("Your search returned ".$count." results");
		}
		if($count>0){
		$curLocation="";
		$curBuilding="";
		foreach($results as $row){
			if($row['building_name']!=$curBuilding){
				$curBuilding=$row['building_name'];
				echo("<h2 class=buildingHead>".$curBuilding."</h2>");
			}
			if($row['location']!=$curLocation){
				if($curLocation!=""){
					echo("</table><br/>");
				}
				$curLocation=$row['location'];
				echo("<h3 class='locationHead'>".$curLocation."</h3>");
				echo("<table class='results'>");
				echo("<th>IP Address</th><th>Serial Number</th><th>Device</th><th>Last Inspected</th><th>Comments</th>");
			}
			echo("<tr>");
			echo("<td><a href='/index/viewdetails?id=".$row["component_id"]."'>".$row["ip_address"]."</a></td><td>".$row["serial_number"]."</td><td>".$row["device_name"]."</td><td>".$row["last_inspected"]."</td><td>".$row["component_comments"]."</td>");
			echo("</tr>");
		}
		echo("</table>");
		}
	?>
</div>
</body>
</html>
